We have already seen a tutorial on how to retrieve the rainfall attribute using the nasapower package. Please have a look at the rainfall tutorial here for the general knowledge on how the nasapower package and it’s functions work.
We will use the same package to retrieve the relative humidity data for specific countries or for the world.
library(nasapower)
First let us have a look at how to get the daily data for humidity in agriculture, this can be done using the get_power() function with the argument pars set to RH2M which means Relative Humidity at 2 meters and passing the argument DAILY to the temporal_average argument at only one location.
data_RH <- get_power(community = "AG",
lonlat = c(134.489563,-25.734968),
dates = c("2010-09-23","2010-12-23"),
temporal_average = "DAILY",
pars = "RH2M")
data_RH %>% datatable(extensions = c('Scroller','FixedColumns'), options = list(
deferRender = TRUE,
scrollY = 350,
scrollX = 350,
dom = 't',
scroller = TRUE,
fixedColumns = list(leftColumns = 3)
))
daily_humidity <- get_power(community = "AG",
lonlat = c(150.5, -28.5 , 153.5, -25.5),
pars = "RH2M",
dates = c("2004-09-19","2004-09-29"),
temporal_average = "DAILY")
daily_humidity %>% datatable(extensions = c('Scroller','FixedColumns'), options = list(
deferRender = TRUE,
scrollY = 350,
scrollX = 350,
dom = 't',
scroller = TRUE,
fixedColumns = list(leftColumns = 3)
))
global data are only available for the climatology temporal_average like we discussed earlier, setting these arguments as such will fetch the global values.
climate_avg_RH <- get_power(community = "AG",
pars = "RH2M",
lonlat = "GLOBAL",
temporal_average = "CLIMATOLOGY"
)
climate_avg_RH %>% datatable(extensions = c('Scroller','FixedColumns'), options = list(
deferRender = TRUE,
scrollY = 350,
scrollX = 350,
dom = 't',
scroller = TRUE,
fixedColumns = list(leftColumns = 3)
))